package c.x.jy.dao.dao;

import c.x.jy.dao.dto.ClubEntityDto;
import c.x.jy.dao.entity.ClubEntity;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 
 * 
 * @author amwhyh
 * @email xxx@xx.com
 * @date 2021-07-12 10:30:08
 */
@Mapper
public interface ClubDao extends BaseMapper<ClubEntity> {

    @Select("select c.*,m.nickname as memberName,m.headimgurl as memberHeadimgurl from t_club c LEFT JOIN t_member m on c.member_id=m.id  ${ew.customSqlSegment} order by create_date desc")
    IPage<ClubEntityDto> querypage(IPage<ClubEntity> page,@Param(Constants.WRAPPER)  QueryWrapper<ClubEntity> query);

    @Select("select c.*,m.nickname as memberName,m.headimgurl as memberHeadimgurl from t_club c LEFT JOIN t_member m on c.member_id=m.id  where c.id=${id}")
    ClubEntityDto getDtoById(Long id);
}

